<template>
	<view class="container">
		<view class="top-box">
			<view class="top-bg">
				<image src="../../static/images/teacher_zone_index.jpg"></image>
			</view>
			<view class="top-avatar-name">
				<view class="top-avatar">
					<image :src="userInfo.userAvatar"></image>
				</view>
				<view class="top-name">{{userInfo.userCollegeName}}({{userInfo.userShortName}})</view>
			</view>
		</view>
		<view class="info-box">
			<view class="info-item" @tap="goInfoModify(1)">
				<view class="info-item-icon">
					<image src="../../static/images/map.png"></image>
				</view>
				<view class="info-item-label">{{userInfo.userArea}}</view>
				<view class="info-item-arrow">
					<image src="../../static/images/more.png"></image>
				</view>
			</view>
			<view class="info-item">
				<view class="info-item-icon">
					<image src="../../static/images/auth.png"></image>
				</view>
				<view class="info-item-label">{{userInfo.userCollegeName}}招生老师</view>
				<view class="info-item-arrow"></view>
			</view>
			<view class="info-item" @tap="goInfoModify(2)">
				<view class="info-item-icon">
					<image src="../../static/images/sign.png"></image>
				</view>
				<view class="info-item-label">{{userInfo.userGreet}}</view>
				<view class="info-item-arrow">
					<image src="../../static/images/more.png"></image>
				</view>
			</view>
			<view class="info-item">
				<view class="info-item-icon">
					<image src="../../static/images/phone.png"></image>
				</view>
				<view class="info-item-label">{{userInfo.userPhoneShow}}</view>
				<view class="info-item-arrow"></view>
			</view>
			<view class="info-pic-item" @tap="goCampusStyle">
				<view class="item-info-box">
					<view class="info-item-icon">
						<image src="../../static/images/camera.png"></image>
					</view>
					<view class="info-item-label">校园风采</view>
					<view class="info-item-arrow">
						<image src="../../static/images/more.png"></image>
					</view>
				</view>
				<view class="pic-list">
					<view class="pic-item" v-if="picIndex < 4" v-for="(pic,picIndex) in albumList" :key="picIndex">
						<image :src="pic"></image>
					</view>
				</view>
			</view>
			<view class="come-in-zone" @tap="goZone">我的动态</view>
		</view>
	</view>
</template>

<script>
	import { domain } from '../../utils'
	
	export default {
		data() {
			return {
				domain: domain,
				albumList: [],
				userInfo: null
			}
		},
		
		onLoad() {
			this.userInfo = uni.getStorageSync('userInfo')
			for (let i = 0; i < this.userInfo.userAlbums.length; i++) {
				if (this.userInfo.userAlbums[i].length > 0) {
					this.albumList.push(this.domain + this.userInfo.userAlbums[i])
				}
			}
		},
		
		methods: {
			
			goZone() {
				uni.navigateTo({
					url: '/pages/teacher_zone/teacher_zone'
				})
			},
			
			goCampusStyle() {
				uni.navigateTo({
					url: '/pages/campus_style/campus_style'
				})
			},
			
			goInfoModify(t) {
				uni.navigateTo({
					url: '/pages/info_modify/info_modify?t=' + t
				})
			}
			
		}
	}
</script>

<style>
	page {
		color: #333333;
	}
	
	.container {
		width: 750rpx;
		height: auto;
	}
	
	.top-box {
		position: relative;
		width: 750rpx;
		height: 514rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	
	.top-bg image {
		width: 750rpx;
		height: 420rpx;
	}
	
	.top-avatar-name {
		width: 100%;
		position: absolute;
		left: 0;
		bottom: 0;
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	
	.top-avatar image {
		width: 120rpx;
		height: 120rpx;
		border-radius: 60rpx;
	}
	
	.top-name {
		font-size: 30rpx;
		font-weight: bold;
	}
	
	.info-box {
		width: 750rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-top: 60rpx;
	}
	
	.info-item {
		width: 700rpx;
		height: 86rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}
	
	.info-item-icon image {
		width: 30rpx;
		height: 30rpx;
	}
	
	.info-item-label {
		width: 590rpx;
		font-size: 26rpx;
		text-align: left;
	}
	
	.info-item-arrow image {
		width: 24rpx;
		height: 24rpx;
	}
	
	.item-info-box {
		width: 700rpx;
		height: 80rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}
	
	.pic-list {
		display: flex;
		flex-direction: row;
		padding-left: 40rpx;
	}
	
	.pic-item {
		margin-left: 16rpx;
	}
	
	.pic-item image {
		width: 124rpx;
		height: 124rpx;
		border-radius: 30rpx;
	}
	
	.come-in-zone {
		width: 700rpx;
		height: 78rpx;
		background-image: linear-gradient(90deg, #ff8806 0%, #fbae2b 100%), linear-gradient(#4482f8, #4482f8);
		border-radius: 40rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		font-size: 36rpx;
		color: #ffffff;
		margin-top: 60rpx;
	}
</style>
